package com.lagou.task.service;

import com.lagou.task.dao.StudentDao;
import com.lagou.task.entity.Student;
import com.lagou.task.factory.StudentDaoFactory;

import java.util.List;

public class StudentService {
    private StudentDao studentDao;

    public StudentService() {
        this.studentDao = StudentDaoFactory.getStudentDao();
    }

    /**
     * 添加学生服务
     * @param student
     * @return
     */
    public int addStudentService(Student student){
        return studentDao.addStudent(student);
    }

    /**
     * 删除学生服务
     * @param student
     * @return
     */
    public int deleteStudentService(Student student){
        return studentDao.deleteStudent(student);
    }

    /**
     * 修改学生服务
     * @param student
     * @return
     */
    public int modifyStudentService(Student student){
        return studentDao.modifyStudent(student);
    }

    /**
     * 查询学生服务
     * @param studentId
     * @return
     */
    public Student findStudentService(String studentId){
        return studentDao.findStudent(studentId);
    }

    /**
     * 显示所有学生服务
     * @return
     */
    public List<Student> showAllService(){
        return studentDao.showAll();
    }

}
